<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>项目类别管理</title>
<link href="<%=path%>/admin/css/admin_right.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/admin/js/check.js"></script>
<script type="text/javascript">
	function checkType(form)
	{
	    var flag=true;
		var user = document.getElementById('_typeName');
		var desc = document.getElementById('_typeDescription');
        if(user.value == ""){
            checkNotNull(user);
        }
		if(desc.value == ""){
            checkNotNull(desc);
		}
		flag = checkForm(form);
		return flag;
	}
	function hintForLength(){
		var user = document.getElementById('_typeName');
		var desc = document.getElementById('_typeDescription');
		
		if(user.value.length >= 20){
		document.getElementById('error1').innerHTML = "项目名最多含20个字符";
		}else{
		document.getElementById('error1').innerHTML = "";
		}
		
		if(desc.value.length >=100){
		document.getElementById('error2').innerHTML = "描述内容最多含100个字符";
		}else{
		document.getElementById('error2').innerHTML = "";
		}
	}
</script>
</head>

<body>
    <div class="main">
        <h1>项目类别管理</h1>
        <hr />
        <h3>现有的项目类别</h3>
        <table width="100%">
            <tr>
                <td class="table_head" width="130px">类别名称</td>
                <td class="table_head" width="85px">团队成员人数</td>
                <td class="table_head" width="85px">评审老师人数</td>
                <td class="table_head">描述</td>
                <td class="table_head" width="60px">状态</td>
                <td class="table_head" width="60px">操作</td>
            </tr>
                <s:iterator id="item" value="projectTypeList">
                <tr>
                     <td>
                        <s:property value="name"/>
                     </td>
                     <td>
                        <s:property value="maxiMemberNumber" />
                     </td>
                     <td>
                        <s:property value="maxiTeacherNumber" />
                     </td>
                     <td>
                     	<s:property value="description"/>
                     </td>
                  <s:if test="enable">
                      <td>开放</td>
                      <td>
                        <a href="projectTypeChange.action?actionType=0&projectTypeID=<s:property value='id'></s:property>">关闭</a>
                      </td>
                  </s:if>
                  <s:else>
                  	  <td>关闭</td>
                      <td><a href="projectTypeChange.action?actionType=1&projectTypeID=<s:property value='id'></s:property>">启动</a></td>
                  </s:else>
                   
                </tr> 
                </s:iterator>
        </table>
        
        <h3>添加新的类别</h3>
        <form action="projectTypeAdd.action" method="post"  onsubmit="return checkType(this);" >
        <table align="center">
            <tr>
                <td class="form_strong" width="150px">类别名称：</td>
                <td><input type="text" name="projectType.name" id="_typeName" maxLength=20 onblur="checkNotNull(this);" onkeyup="checkNotNull(this);hintForLength()"/>
                <span id="error1" style="text-align:center; color:#FF0000;"></span></td>
            </tr>
            
            <tr>
               <td class="form_strong" width="150px">团队成员人数限制:</td>
               <td>
                 <select name="projectType.maxiMemberNumber">
                	<option value="1">1</option>
                	<option value="2">2</option>
                	<option value="3">3</option>
                	<option value="4">4</option>
                	<option value="5">5</option>
                	<option value="6">6</option>
                	<option value="7">7</option>
                	<option value="8">8</option>
                	<option value="9">9</option>
                	<option value="10">10</option>
                </select>
               </td>
               </tr>
               <tr>
               <td class="form_strong" width="150px">评审老师人数限制:</td>
               <td>
                 <select name="projectType.maxiTeacherNumber">
                	<option value="1">1</option>
                	<option value="2">2</option>
                	<option value="3">3</option>
                	<option value="4">4</option>
                	<option value="5">5</option>
                	<option value="6">6</option>
                	<option value="7">7</option>
                	<option value="8">8</option>
                	<option value="9">9</option>
                	<option value="10">10</option>
                </select>
               </td>
            </tr>
            
            <tr>
                <td class="form_strong" >描述：</td>
                <td>
                <textarea cols="50" rows="5" name="projectType.description" id="_typeDescription" 
                onkeydown="checkTextAreaLength(this, 0, 100);"
                onblur="checkNotNull(this);" onkeyup="checkNotNull(this);hintForLength();checkTextAreaLength(this, 0, 100);"></textarea>
                </td>
                </tr>
                <tr>
                <td colspan="2" align="center">
                <span id="error2" style="text-align:center; color:#FF0000;"></span>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                	<input type="submit" value="  添加  " />
                </td>
            </tr>
        </table>
        </form>
    </div>
</body>
</html>
